﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.VisualStudio.Modeling.Diagrams;
using Microsoft.VisualStudio.Modeling;

namespace DSLFactory.VSCTDesigner
{
    partial class GroupShape
    {
        public override bool HasShadow
        {
            get
            {
                return false;
            }
        }

        protected override void Collapse()
        {
            base.Collapse();
            using( Transaction transaction = this.Store.TransactionManager.BeginTransaction("Collapse children") )
            {
                ShapeHelper.ShowHideChildren(this, false);
                transaction.Commit();
            }
        }

        protected override void Expand()
        {
            base.Expand();
            using( Transaction transaction = this.Store.TransactionManager.BeginTransaction("Expand children") )
            {
                ShapeHelper.ShowHideChildren(this, true);
                transaction.Commit();
            }
        }

        public override bool HasConnectionPoints
        {
            get
            {
                return true;
            }
        }

        public override void EnsureConnectionPoints(Microsoft.VisualStudio.Modeling.Diagrams.LinkShape link)
        {
            CreateConnectionPoint(new Microsoft.VisualStudio.Modeling.Diagrams.PointD(this.AbsoluteBoundingBox.Left+0.01,
                this.AbsoluteBoundingBox.Bottom));

            CreateConnectionPoint(new Microsoft.VisualStudio.Modeling.Diagrams.PointD(this.AbsoluteBoundingBox.Left,
                this.AbsoluteBoundingBox.Center.Y));
            //CreateConnectionPoint(new Microsoft.VisualStudio.Modeling.Diagrams.PointD(this.AbsoluteBoundingBox.Right,
            //    this.AbsoluteBoundingBox.Center.Y));
        }
    }
}
